home *** CD-ROM | disk | FTP | other *** search
Wrap
/* File: TextUtils.h Contains: Text Utilities Interfaces. Version: Technology: System 7.0 through System 8 Release: Universal Interfaces 3.0d3 on Copland DR1 Copyright: © 1984-1996 by Apple Computer, Inc. All rights reserved. Bugs?: If you find a problem with this file, send the file and version information (from above) and the problem description to: Internet: apple.bugs@applelink.apple.com AppleLink: APPLE.BUGS */ #ifndef __TEXTUTILS__ #define __TEXTUTILS__ #ifndef __TYPES__ #include <Types.h> #endif #ifndef __SCRIPT__ #include <Script.h> #endif #ifndef __OSUTILS__ #include <OSUtils.h> #endif #ifndef __TEXTOBJECTS__ #include <TextObjects.h> #endif #ifndef __NUMBERFORMATTING__ #include <NumberFormatting.h> #endif #ifndef __TIMEOBJECTS__ #include <TimeObjects.h> #endif #ifndef __STRINGCOMPARE__ #include <StringCompare.h> #endif /* FOR_SYSTEM8_PREEMPTIVE*/ #ifdef __cplusplus extern "C" { #endif #if PRAGMA_IMPORT_SUPPORTED #pragma import on #endif #if PRAGMA_ALIGN_SUPPORTED #pragma options align=mac68k #endif /* Here are the current System 7 routine names and the translations to the older forms. Please use the newer forms in all new code and migrate the older names out of existing code as maintainance permits. NEW NAME OLD NAMEs OBSOLETE FORM (no script code) FindScriptRun FindWordBreaks NFindWord, FindWord GetIndString GetString Munger NewString SetString StyledLineBreak TruncString TruncText UpperString ($A054) UprString, UprText UppercaseText SCUpperText (a only) UpperText ($A456) LowercaseText LwrString, LowerText, LwrText ($A056) StripDiacritics StripText ($A256) UppercaseStripDiacritics StripUpperText ($A656) */ #if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE /* Type for truncWhere parameter in TruncString, TruncText */ typedef short TruncCode; enum { /* Constants for truncWhere argument in TruncString and TruncText */ truncEnd = 0, /* Truncate at end */ truncMiddle = 0x4000, /* Truncate in middle */ smTruncEnd = 0, /* Truncate at end - obsolete */ smTruncMiddle = 0x4000, /* Truncate in middle - obsolete */ /* Constants for TruncString and TruncText results */ notTruncated = 0, /* No truncation was necessary */ truncated = 1, /* Truncation performed */ truncErr = -1, /* General error */ smNotTruncated = 0, /* No truncation was necessary - obsolete */ smTruncated = 1, /* Truncation performed - obsolete */ smTruncErr = -1 /* General error - obsolete */ }; typedef SInt8 StyledLineBreakCode; enum { smBreakWord = 0, smBreakChar = 1, smBreakOverflow = 2 }; struct ScriptRunStatus { SInt8 script; SInt8 runVariant; }; typedef struct ScriptRunStatus ScriptRunStatus; struct BreakTable { char charTypes[256]; short tripleLength; short triples[1]; }; typedef struct BreakTable BreakTable; typedef BreakTable *BreakTablePtr; struct NBreakTable { SInt8 flags1; SInt8 flags2; short version; short classTableOff; short auxCTableOff; short backwdTableOff; short forwdTableOff; short doBackup; short length; /* length of NBreakTable */ char charTypes[256]; short tables[1]; }; typedef struct NBreakTable NBreakTable; typedef NBreakTable *NBreakTablePtr; /* The following functions are new names that work on 68k and PowerPC */ extern pascal long Munger(Handle h, long offset, const void *ptr1, long len1, const void *ptr2, long len2) ONEWORDINLINE(0xA9E0); extern pascal StringHandle NewString(ConstStr255Param theString) ONEWORDINLINE(0xA906); extern pascal void SetString(StringHandle theString, ConstStr255Param strNew) ONEWORDINLINE(0xA907); extern pascal StringHandle GetString(short stringID) ONEWORDINLINE(0xA9BA); extern pascal void GetIndString(Str255 theString, short strListID, short index); extern pascal StyledLineBreakCode StyledLineBreak(Ptr textPtr, long textLen, long textStart, long textEnd, long flags, Fixed *textWidth, long *textOffset) FOURWORDINLINE(0x2F3C, 0x821C, 0xFFFE, 0xA8B5); extern pascal short TruncString(short width, Str255 theString, TruncCode truncWhere) FOURWORDINLINE(0x2F3C, 0x8208, 0xFFE0, 0xA8B5); extern pascal short TruncText(short width, Ptr textPtr, short *length, TruncCode truncWhere) FOURWORDINLINE(0x2F3C, 0x820C, 0xFFDE, 0xA8B5); extern pascal void FindWordBreaks(Ptr textPtr, short textLength, short offset, Boolean leadingEdge, BreakTablePtr breaks, OffsetTable offsets, ScriptCode script) FOURWORDINLINE(0x2F3C, 0xC012, 0x001A, 0xA8B5); extern pascal void LowercaseText(Ptr textPtr, short len, ScriptCode script) SIXWORDINLINE(0x3F3C, 0x0000, 0x2F3C, 0x800A, 0xFFB6, 0xA8B5); extern pascal void UppercaseText(Ptr textPtr, short len, ScriptCode script) SIXWORDINLINE(0x3F3C, 0x0400, 0x2F3C, 0x800A, 0xFFB6, 0xA8B5); extern pascal void StripDiacritics(Ptr textPtr, short len, ScriptCode script) SIXWORDINLINE(0x3F3C, 0x0200, 0x2F3C, 0x800A, 0xFFB6, 0xA8B5); extern pascal void UppercaseStripDiacritics(Ptr textPtr, short len, ScriptCode script) SIXWORDINLINE(0x3F3C, 0x0600, 0x2F3C, 0x800A, 0xFFB6, 0xA8B5); extern pascal ScriptRunStatus FindScriptRun(Ptr textPtr, long textLen, long *lenUsed) FOURWORDINLINE(0x2F3C, 0x820C, 0x0026, 0xA8B5); #endif /* FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE*/ #if FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE extern pascal void UpperString(Str255 theString, Boolean diacSensitive); #if CGLUESUPPORTED extern void upperstring(char *theString, Boolean diacSensitive); #endif /* CGLUESUPPORTED The following are macros which map old names to the names exported by InterfaceLib */ #if OLDROUTINENAMES #if FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED #define UprString(theString, diacSensitive) \ UpperString(theString, diacSensitive) #if CGLUESUPPORTED #define uprstring(theString, diacSensitive) upperstring(theString, diacSensitive) #endif #endif /* FOR_SYSTEM7_AND_SYSTEM8_DEPRECATED*/ #endif /* OLDROUTINENAMES*/ /* Old routine name but no new names are mapped to it:*/ #if GENERATING68K && !GENERATINGCFM #pragma parameter UprText(__A0, __D0) #endif extern pascal void UprText(Ptr textPtr, short len) ONEWORDINLINE(0xA054); #endif /* FOR_SYSTEM7_AND_SYSTEM8_PREEMPTIVE*/ /* The following functions are old names, but are required for PowerPC builds because InterfaceLib exports these names, instead of the new ones. */ #if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE extern pascal void FindWord(Ptr textPtr, short textLength, short offset, Boolean leadingEdge, BreakTablePtr breaks, OffsetTable offsets) FOURWORDINLINE(0x2F3C, 0x8012, 0x001A, 0xA8B5); extern pascal void NFindWord(Ptr textPtr, short textLength, short offset, Boolean leadingEdge, NBreakTablePtr nbreaks, OffsetTable offsets) FOURWORDINLINE(0x2F3C, 0x8012, 0xFFE2, 0xA8B5); #if GENERATING68K && !GENERATINGCFM #pragma parameter LwrText(__A0, __D0) #endif extern pascal void LwrText(Ptr textPtr, short len) ONEWORDINLINE(0xA056); #if GENERATING68K && !GENERATINGCFM #pragma parameter LowerText(__A0, __D0) #endif extern pascal void LowerText(Ptr textPtr, short len) ONEWORDINLINE(0xA056); #if GENERATING68K && !GENERATINGCFM #pragma parameter StripText(__A0, __D0) #endif extern pascal void StripText(Ptr textPtr, short len) ONEWORDINLINE(0xA256); #if GENERATING68K && !GENERATINGCFM #pragma parameter UpperText(__A0, __D0) #endif extern pascal void UpperText(Ptr textPtr, short len) ONEWORDINLINE(0xA456); #if GENERATING68K && !GENERATINGCFM #pragma parameter StripUpperText(__A0, __D0) #endif extern pascal void StripUpperText(Ptr textPtr, short len) ONEWORDINLINE(0xA656); #endif /* FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE*/ #if CGLUESUPPORTED #if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE extern void setstring(StringHandle theString, const char *strNew); extern StringHandle newstring(const char *theString); extern void getindstring(char *theString, short strListID, short index); #endif #endif /* CGLUESUPPORTED*/ #if !OLDROUTINELOCATIONS #if FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE extern StringPtr c2pstr(char *aStr); extern pascal StringPtr C2PStr(Ptr cString); extern char *p2cstr(StringPtr aStr); extern pascal Ptr P2CStr(StringPtr pString); extern void c2pstrcpy(Str255 dst, const char *src); extern void p2cstrcpy(char *dst, ConstStr255Param src); extern void CopyPascalStringToC(ConstStr255Param src, char *dst); extern void CopyCStringToPascal(const char *src, Str255 dst); #endif /* FOR_SYSTEM7_AND_SYSTEM8_COOPERATIVE*/ #endif /* !OLDROUTINELOCATIONS*/ #if PRAGMA_ALIGN_SUPPORTED #pragma options align=reset #endif #if PRAGMA_IMPORT_SUPPORTED #pragma import off #endif #ifdef __cplusplus } #endif #endif /* __TEXTUTILS__ */